<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Maven Goals</title>
</head>

<body>

<h2>Maven Goals</h2>

<p>JBehave supports accessing the Embedder functionality via Maven
goals:</p>

<ul>
    <li><a
        href="javadoc/maven-plugin/org/jbehave/mojo/MapStoriesAsEmbeddables.html">map-stories-as-embeddables</a></li>
    <li><a
        href="javadoc/maven-plugin/org/jbehave/mojo/MapStoriesAsPaths.html">map-stories-as-paths</a></li>
	<li><a
		href="javadoc/maven-plugin/org/jbehave/mojo/RunStoriesAsEmbeddables.html">run-stories-as-embeddables</a></li>
	<li><a
		href="javadoc/maven-plugin/org/jbehave/mojo/RunStoriesAsPaths.html">run-stories-as-paths</a></li>
	<li><a
		href="javadoc/maven-plugin/org/jbehave/mojo/RunStoriesWithAnnotatedEmbedderRunner.html">run-stories-with-annotated-embedder</a></li>
	<li><a
		href="javadoc/maven-plugin/org/jbehave/mojo/ReportStepdocs.html">report-stepdocs</a></li>
    <li><a
        href="javadoc/maven-plugin/org/jbehave/mojo/ReportStepdocsAsEmbeddables.html">report-stepdocs-as-embeddables</a></li>
	<li><a
		href="javadoc/maven-plugin/org/jbehave/mojo/GenerateStoriesView.html">generate-stories-view</a></li>
    <li><a
        href="javadoc/maven-plugin/org/jbehave/mojo/UnpackViewResources.html">unpack-view-resources</a></li>
</ul>

<p>Maven goals support the following properties:</p>

<ul>
	<li>sourceDirectory: defaults to <b>src/main/java</b></li>
	<li>testSourceDirectory: defaults to <b>src/test/java</b></li>
    <li>outputDirectory: defaults to <b>target/classes</b></li>
    <li>testOutputDirectory: defaults to <b>target/test-classes</b></li>
	<li>scope: [compile|test], defaults to <b>compile</b></li>
	<li>includes: list of include patterns</li>
	<li>excludes: list of exclude patterns</li>
	<li>metaFilters: list of meta filters</li>
	<li>systemProperties: list of system properties to set during execution</li>
	<li>batch: [true|false], defaults to <b>false</b></li>
	<li>skip: [true|false], defaults to <b>false</b></li>
	<li>ignoreFailureInStories: [true|false], defaults to <b>false</b></li>
	<li>ignoreFailureInView: [true|false], defaults to <b>false</b></li>
	<li>generateViewAfterStories: [true|false], defaults to <b>true</b></li>
    <li>storyTimeoutInSecs: defaults to <b>300</b></li>
    <li>storyTimeoutInSecsByPath: defaults to <b>300 (the default of storyTimeoutInSecs)</b></li>
    	<ul>
    		<li>Overrides the default value in storyTimeoutInSecs, and can be expressed as a CSV of regex
    		<br>expressions matching story paths. E.g. "*/long/.story:5000,*/short/.story:200,*/medium/m_story.story:1000"</br></li>
    	</ul>
	<li>failOnStoryTimeout: [true|false], defaults to <b>false</b></li>
    <li>threads: defaults to <b>1</b></li>
	<li>embedderClass: defaults to <a
		href="javadoc/core/org/jbehave/core/embedder/Embedder.html">Embedder</a>.</li>
	<li>injectableEmbedderClass: defaults to <code>null</code></li>
	<li>storyFinderClass: defaults to <a
		href="javadoc/core/org/jbehave/core/io/StoryFinder.html">StoryFinder</a></li>
</ul>

<span class="followup">Performance Testing: You can make use of
<b>storyTimeoutInSecs</b> and <b>storyTimeoutInSecsByPath</b> to ensure
tests run under the time(s) specified
</span>

<p>In addition, the <b>unpack-view-resources</b> goal supports the properties:</p>

<ul>
    <li>resourceArtifactIds: list of resource artifactIds, optional (defaults to <b>{"jbehave-site-resources", "jbehave-core"}</b>)</li>
    <li>resourceTypes: list of resource types, optional (defaults to <b>{"zip"}</b>)</li>
    <li>resourceIncludes: the pattern of includes when unpacking each resource, optional (defaults to includes all)</li>
    <li>resourceExcludes: the pattern of excludes when unpacking each resource, optional (defaults to excludes none)</li>
    <li>viewDirectory: the output directory of the resources, optional (defaults to the one configured in the Embedder <a
        href="javadoc/core/org/jbehave/core/reporters/StoryReporterBuilder.html">StoryReporterBuilder</a>)</li>
</ul>

<p>An example of a typical Maven plugin usage is:</p>
<script type="syntaxhighlighter" class="brush: xml">
<![CDATA[
    <plugin>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave-maven-plugin</artifactId>
        <version>[version]</version>
        <executions>
            <execution>
                <id>run-stories-as-embeddables</id>
                <phase>integration-test</phase>
                <configuration>
                    <includes>
                        <include>**/*Stories.java</include>
                    </includes>
                    <metaFilters>
                        <metaFilter>+author *</metaFilter>
                        <metaFilter>-skip</metaFilter>
                    </metaFilters>
                    <systemProperties>
                        <property>
                          <name>java.awt.headless</name>
                          <value>true</value>
                        </property>
                    </systemProperties>
                    <ignoreFailureInStories>true</ignoreFailureInStories>
                    <ignoreFailureInView>false</ignoreFailureInView>
                </configuration>
                <goals>
                    <goal>run-stories-as-embeddables</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
]]>
</script>

<p>The default scope is <b>compile</b>, which means that the stories
will be looked up in the POM source directory. If the scope is set to <b>test</b>
the stories will be looked up in the POM test source directory.</p>

<h2>ClassLoading Logging Frameworks</h2>

<p>JBehave uses FreeMarker to generate template-based reports.
FreeMarker uses its own version of a logging facade framework which
auto-discovers different logging frameworks, notably JDK Logging and
Apache log4j. When using the JBehave Maven Plugin, and depending on the
rest of your POM configuration, you may need to add Apache log4j as
Plugin Dependency (as opposed to the Project Dependency) if you find
that it's not able to load its classes, e.g.:</p>

<script type="syntaxhighlighter" class="brush: xml">
<![CDATA[
    <plugin>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave-maven-plugin</artifactId>
        <version>[version]</version>
        <executions>
            <!-- define executions as normal -->
        </executions>
        <dependencies>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.16</version>
            </dependency>
        </dependencies>
    </plugin>
]]>
</script>

<h2>ClassLoading Groovy Meta Matcher</h2>

<p>When using the JBehave Maven Plugin with a Groovy Meta Matcher you need to
configure Groovy as Plugin Dependency (as opposed to the Project Dependency):</p>

<script type="syntaxhighlighter" class="brush: xml">
<![CDATA[
    <plugin>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave-maven-plugin</artifactId>
        <version>[version]</version>
        <executions>
            <!-- define executions as normal -->
            <metaFilters>
                <metaFilter>"groovy: lang != 'java'"</metaFilter>
            </metaFilters>
        </executions>
        <dependencies>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>1.8.4</version>
            </dependency>
        </dependencies>
    </plugin>
]]>
</script>


<div class="clear">
<hr />
</div>

</body>
</html>
